package gov.cn.user.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import gov.cn.user.entity.UserInfo;
import gov.cn.user.exception.UserException;
import gov.cn.user.service.LoginService;
import gov.cn.user.service.UserService;
import gov.cn.user.vo.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.util.List;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Resource
    private LoginService loginService;

    @Resource
    protected HttpServletRequest request;

    @GetMapping("/login")
    public AjaxResult list(UserInfo userInfo){
        try {
            loginService.login(userInfo);
        } catch (UserException e) {
            return AjaxResult.fail(e.getMessage());
        }
        return AjaxResult.ok();
    }

}
